home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14937 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: jupiter.cc.gettysburg.edu!wilson    
  2. From: "Michael L. Nicastro" <mnicastr@oberon.hs.gettysburg.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Binary Converter
  5. Date: Tue, 02 Apr 1996 14:59:37 -0500
  6. Organization: Gettysburg College
  7. Message-ID: <31618729.6BC22935@oberon.hs.gettysburg.edu>
  8. NNTP-Posting-Host: oberon.hs.gettysburg.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i586)
  13.  
  14. I am working on a binary converter function, and it isn't working
  15. correctly.  I am basically passing a number to be converted to the
  16. function, then using if statements to see which place of the number
  17. would be in, dividing, and then doing the same with the remainder, until
  18. the ones place.  Each time the number fits one of the if statements, it
  19. copies a one to a string, and for every if it does not fit, it copies a
  20. zero. Lastly it returns the converted binary number.  Does anyone know a
  21. better way of doing this?  Or why mine would not be working (I would
  22. include the source here, but I had some trouble, and had to reformat my
  23. drive, so it is gone as of now).  If you can help, please email me at
  24. mnicastr@oberon.hs.gettysburg.edu
  25. Thanks
  26.